<template>
	<div class="box">
		<div style="margin-top: 10px;">
			<div class="guanli"><span @click="guanLi">{{gu}}</span></div>
			<van-grid :column-num="2" :border="false">
				<van-grid-item v-for="(item, index) in bastList" :key="index"
					 @click="onto(item)">
					<input type="radio" class="onbut" v-show="buangli">
					<van-image :src="imgUrls+item.image" height="140" />
					<span>
						<font size="2">{{ item.storeName }}</font>
					</span>
					<span>
						<font size="4" color="#ff8001">￥{{ item.price }}</font>
						<font size="2" color="#C0C4CC" style="text-decoration:line-through">￥{{item.otPrice}}
						</font>
					</span>
				</van-grid-item>
			</van-grid>
		</div>
	</div>
</template>

<script>
	import {
		getData,
		groupList,
		getMenus,
		getLike,
		getCombinationList,
		getBastList,
		getBanner
	} from "@/api/home.js"
	export default {
		data() {
			return {
				imgUrls: this.$baseApi,
				menus: [],
				groupLists: [],
				bastList: [],
				slideshowList: [],
				guesslikes: [],
				value: '',
				buangli:false,
				gu:"管理",
			};
		},

		created() {
			this.getData();
		},
		methods: {
			getData() {
				getMenus().then(res => {
					this.menus = res.data
				})
				getLike().then(res => {
					this.guesslikes = res.data
				})

				getBastList().then(res => {
					this.bastList = res.data
				})
				getBanner().then(res => {
					this.slideshowList = res.data
				})
			},
			goto(url) {
				this.$router.push(url)
			},
			onfocus() {
				this.$router.push("/search")
			},
			onto(item){
				// :to="'/productDetails?id='+item.id"
				if(!this.buangli){
					this.$router.push(`//productDetails?id='+${item.id}`);
				}
			},
			guanLi(){
				
				this.gu = this.buangli ? "管理" : "取消" 
				this.buangli = !this.buangli;
			}
		},
	};
</script>

<style scoped>
	.onbut{
		position: absolute;
		top: 5px;
		left: 5px;
	}
	.guanli{
		height: 40px;
		width: 100%;
		background-color: #fff;
		line-height: 40px;
		text-align: right;
		font-size: 16px;
	}
	.guanli span{
		margin-right: 15px;
	}
</style>
